#include<bits/stdc++.h>
using namespace std;
int a[2001];
int sum = 0;



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    int T,n;
    cin >> T;
    for(int i = 0;i<T;i++){
        cin >> n;
        for (int j = 0;j<n;j++){
            cin >> a[i];
        }
        sort(a,a+n);
        for(int k = 0;k<n;k++){
                cout << a[k];
            if (a[k] == a[k+1]){
                sum += a[k];
                a[k+1] = 0;
                a[k] = 0;
            }
        }
        cout << sum<<endl;
    }
    return 0;
}
